/**
 * 实现LED灯的交替闪烁
 */
#include <REGX52.H>

sbit LED = P0 ^ 0;

void delay_ms(unsigned int ms)
{
    unsigned int i, j;
    for (i = 0; i < ms; i++){
        for (j = 0; j < 123; j++)
            ;
    }
}

void main()
{
    LED = 1;
    while (1)
    {
        LED = ~LED;
        delay_ms(150);
    }
}